home *** CD-ROM | disk | FTP | other *** search
/ The World's Largest Collection of Windows Software / The World's Largest Collection of Windows Software - Disc 1.iso / connect / _j2 / wvnsc926 / rcs / wvpost.c < prev    next >
C/C++ Source or Header  |  1994-09-21  |  25KB  |  1,313 lines

  1. head     1.24;
  2. branch   ;
  3. access   ;
  4. symbols  V80:1.4 V76d:1.1;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.24
  10. date     94.09.18.22.49.37;  author jcooper;  state Exp;
  11. branches ;
  12. next     1.23;
  13.  
  14. 1.23
  15. date     94.09.16.01.05.38;  author jcooper;  state Exp;
  16. branches ;
  17. next     1.22;
  18.  
  19. 1.22
  20. date     94.08.24.18.40.15;  author mrr;  state Exp;
  21. branches ;
  22. next     1.21;
  23.  
  24. 1.21
  25. date     94.06.09.18.39.34;  author rushing;  state Exp;
  26. branches ;
  27. next     1.20;
  28.  
  29. 1.20
  30. date     94.06.06.22.15.31;  author rushing;  state Exp;
  31. branches ;
  32. next     1.19;
  33.  
  34. 1.19
  35. date     94.06.03.20.44.34;  author rushing;  state Exp;
  36. branches ;
  37. next     1.18;
  38.  
  39. 1.18
  40. date     94.05.27.01.29.29;  author rushing;  state Exp;
  41. branches ;
  42. next     1.17;
  43.  
  44. 1.17
  45. date     94.05.26.22.19.08;  author jglasser;  state Exp;
  46. branches ;
  47. next     1.16;
  48.  
  49. 1.16
  50. date     94.05.19.02.02.10;  author rushing;  state Exp;
  51. branches ;
  52. next     1.15;
  53.  
  54. 1.15
  55. date     94.02.09.18.39.32;  author rushing;  state Exp;
  56. branches ;
  57. next     1.14;
  58.  
  59. 1.14
  60. date     94.02.09.18.01.08;  author cnolan;  state Exp;
  61. branches ;
  62. next     1.13;
  63.  
  64. 1.13
  65. date     94.01.24.17.40.28;  author jcoop;  state Exp;
  66. branches ;
  67. next     1.12;
  68.  
  69. 1.12
  70. date     94.01.15.20.35.34;  author jcoop;  state Exp;
  71. branches ;
  72. next     1.11;
  73.  
  74. 1.11
  75. date     94.01.11.18.51.45;  author cnolan;  state Exp;
  76. branches ;
  77. next     1.10;
  78.  
  79. 1.10
  80. date     93.12.08.01.28.01;  author rushing;  state Exp;
  81. branches ;
  82. next     1.9;
  83.  
  84. 1.9
  85. date     93.08.25.18.53.17;  author mbretherton;  state Exp;
  86. branches ;
  87. next     1.8;
  88.  
  89. 1.8
  90. date     93.08.25.17.05.17;  author mbretherton;  state Exp;
  91. branches ;
  92. next     1.7;
  93.  
  94. 1.7
  95. date     93.07.06.21.09.50;  author cnolan;  state Exp;
  96. branches ;
  97. next     1.6;
  98.  
  99. 1.6
  100. date     93.07.06.17.11.56;  author rushing;  state Exp;
  101. branches ;
  102. next     1.5;
  103.  
  104. 1.5
  105. date     93.06.28.17.52.17;  author rushing;  state Exp;
  106. branches ;
  107. next     1.4;
  108.  
  109. 1.4
  110. date     93.06.11.00.10.35;  author rushing;  state Exp;
  111. branches ;
  112. next     1.3;
  113.  
  114. 1.3
  115. date     93.05.25.00.00.45;  author rushing;  state Exp;
  116. branches ;
  117. next     1.2;
  118.  
  119. 1.2
  120. date     93.05.08.17.11.54;  author rushing;  state Exp;
  121. branches ;
  122. next     1.1;
  123.  
  124. 1.1
  125. date     93.02.16.20.54.22;  author rushing;  state Exp;
  126. branches ;
  127. next     ;
  128.  
  129.  
  130. desc
  131. @winvn version 0.76 placed into RCS
  132. @
  133.  
  134.  
  135. 1.24
  136. log
  137. @support for cascading windows
  138. @
  139. text
  140. @
  141. /*
  142.  * $Id: wvpost.c 1.23 1994/09/16 01:05:38 jcooper Exp $
  143.  */
  144.  
  145. /*--- WVPOST.C ------------------------------------------------------------
  146.  *
  147.  *    This file contains the window procedure for the "posting" windows,
  148.  *    windows in which the user edits the text of an article to be posted.
  149.  *
  150.  *    Mark Riordan   27 Jan 1990
  151.  */
  152. #include <windows.h>
  153. #include <windowsx.h>
  154. #include "wvglob.h"
  155. #include "winvn.h"
  156. #pragma hdrstop
  157. #include <commdlg.h>
  158.  
  159. /* globals */
  160. static char CurrentPostTitle[MAXINTERNALLINE];
  161. static char *CurrentPostEdit;
  162.  
  163. long FAR PASCAL 
  164. WinVnPostWndProc (hWnd, message, wParam, lParam)
  165.      HWND hWnd;
  166.      unsigned message;
  167.      WPARAM wParam;
  168.      LPARAM lParam;
  169. {
  170.  
  171.   WndEdit * WndPost;
  172.   int ih;
  173.  
  174.   WndPost = getWndEdit(WndPosts,hWnd,MAXPOSTWNDS) ;
  175.  
  176.   if ((!WndPost) && message == WM_CREATE)
  177.     {
  178.       for (ih = 0; ih < MAXPOSTWNDS; ih++)
  179.    {
  180.      if (!WndPosts[ih].hWnd)
  181.        {
  182.          WndPost = &WndPosts[ih] ;
  183.          WndPost->hWnd = hWnd;
  184.          WndPost->Doc = PostDoc ;
  185.  
  186.          break;
  187.        }
  188.    }
  189.     }
  190.  
  191.   switch (message)
  192.     {
  193.     case WM_SYSCOMMAND:
  194.       return (DefWindowProc (hWnd, message, wParam, lParam));
  195.  
  196.     case WM_CREATE:
  197.       if (CreateEditWnd (WndPost) == FAIL)
  198.          break;
  199.       
  200.       NumPostWnds++;
  201.  
  202.       SendMessage (WndPost->hWndEdit, WM_SETFONT, (WPARAM)hFontArtNormal, TRUE);
  203.       
  204.       WndPost->dirty = DT_CLEAN ;
  205.       if (!Attaching)
  206.          CreatePostingText (PostDoc, hWnd, WndPost->hWndEdit, DOCTYPE_POSTING);
  207.  
  208.       /* Subclass the edit window to pass acceleratprs to parent */
  209.       SetWindowLong(WndPost->hWndEdit, GWL_WNDPROC, (LONG) lpfnEditSubClass);
  210.       break;
  211.  
  212. #ifdef _WIN32
  213.     case WM_CTLCOLOREDIT:
  214. #else
  215.    case WM_CTLCOLOR:    //WIN32 doesn't handle this message anymore
  216.       // Set foreground and background colors of edit control
  217.       if (HIWORD(lParam) == CTLCOLOR_EDIT)
  218. #endif
  219.       {
  220.          SetTextColor((HDC)wParam, ArticleTextColor);
  221.          SetBkColor((HDC)wParam, ArticleBackgroundColor);
  222.          // Return handle to background brush for the edit control
  223.          return (LRESULT)hArticleBackgroundBrush;
  224.       }
  225.       break;
  226.  
  227.     case WM_SIZE:
  228.  
  229.       MoveWindow (WndPost->hWndEdit, 0, 0, LOWORD (lParam),
  230.         HIWORD (lParam), TRUE);
  231.       break;
  232.  
  233.     case WM_SETFOCUS:
  234.  
  235.       SetFocus (WndPost->hWndEdit);
  236.       break;
  237.  
  238.     case WM_KEYDOWN:
  239.  
  240.       if (wParam == VK_F6)
  241.    {
  242.      NextWindow (WndPost->Doc);
  243.    }
  244.       break;
  245.  
  246.     case WM_INITMENUPOPUP :
  247.  
  248.       prepareEditMenu (hWnd, WndPost->hWndEdit);
  249.       break ;
  250.  
  251.  
  252.     case WM_COMMAND:
  253.     // Edit Window notifications to parent
  254.     if ((HWND)(UINT)lParam == WndPost  ->hWndEdit){     
  255. #ifdef WIN32
  256.        if (HIWORD(wParam) == EN_CHANGE)
  257. #else
  258.        if (HIWORD(lParam) == EN_CHANGE)
  259. #endif
  260.         WndPost->dirty = DT_DIRTY ;
  261.     return(0L) ;
  262.       }
  263.  
  264.       switch (LOWORD(wParam))
  265.       {
  266.    case IDM_CANCEL:
  267.  
  268.    case IDV_EXIT:
  269.         DoEditClose(WndPost->hWnd,WndPost->dirty);
  270.      break;
  271.  
  272.    case IDM_SEND:
  273.      StartPost (WndPost);
  274.      break;
  275.  
  276.    case IDM_PRINT:
  277.      PrintFile (WndPost->hWndEdit);
  278.      break;
  279.  
  280.    case IDM_ATTACH:
  281.      if (TestDecodeBusy(hWndConf, "Can't make attachment"))
  282.        break;
  283.  
  284.      if (AskForExistingFileName (hWnd, AttachFileName, "Open file to attach") == FAIL)
  285.       break;
  286.            if (DialogBox (hInst, "WinVnAttach", hWnd, lpfnWinVnAttachDlg))
  287.            Attach (WndPost, AttachFileName, DOCTYPE_POSTING);
  288.      
  289.      InvalidateRect (hWnd, NULL, TRUE);
  290.           break;
  291.  
  292.    default:
  293.      DoEditCommands (WndPost->hWndEdit, wParam, lParam);
  294.    break;
  295.       }
  296.  
  297.       break;
  298.       
  299.     case WM_DESTROY:
  300. //    editDS = GetWindowWord (WndPost->hWndEdit, GWW_HINSTANCE);
  301. //    GlobalFree (editDS); // must manually free global GMEM_SHARE instance
  302.       WndPost->hWnd = 0;
  303.       WndPost->hWndEdit = 0;
  304.       NumPostWnds--;
  305.       break;
  306.  
  307.     case WM_CLOSE:
  308.       if (CommBusy && PostEdit == WndPost)
  309.    MessageBox (hWnd,
  310.      "Please wait until posting is complete",
  311.      "Cannot close posting window", MB_OK|MB_ICONSTOP);
  312.       else
  313.    DoEditClose(WndPost->hWnd,WndPost->dirty);
  314.       break;
  315.  
  316.     default:
  317.       return (DefWindowProc (hWnd, message, wParam, lParam));
  318.  
  319.     }
  320.   return (0L);
  321. }
  322.  
  323. /*--- function StartPost ----------------------------------------------
  324.  *
  325.  *    Start the posting procedure for an article that has been created
  326.  *    by the user.
  327.  *
  328.  */
  329. BOOL
  330. StartPost (WndEdit *thisPost)
  331. {
  332.   BOOL PostOK = FALSE;
  333.   char outline[MAXOUTLINE];
  334.  
  335.   if (!TestCommBusy(thisPost->hWnd, "Can't post article right now"))
  336.     {
  337.       CommLinePtr = CommLineIn;
  338.       CommBusy = TRUE;
  339.       CommState = ST_POST_WAIT_PERMISSION;
  340.       CommWnd = thisPost->hWnd;
  341.       PostEdit = thisPost;
  342.       strcpy (outline, "POST");
  343.       PutCommLine (outline);
  344.       PostOK = TRUE;
  345.     }
  346.   return (PostOK);
  347. }
  348.  
  349. /*--- function PostText -------------------------------------------------
  350.  *
  351.  *    Post the text of an article.  (Second phase of posting process.)
  352.  *
  353.  *    Entry    ih    is the index into hWndPostEdits of the child
  354.  *                   edit window containing the article.
  355.  */
  356. BOOL
  357. PostText (WndEdit * WndPost)
  358. {
  359.   BOOL EndBuf = FALSE;
  360.   
  361.   GetWindowText(WndPost->hWnd, CurrentPostTitle, MAXINTERNALLINE-1);
  362.   strcpy(str, CurrentPostTitle);
  363.   strcat(str, "  [Posting...]");
  364.   SetWindowText (WndPost->hWnd, str);
  365.   
  366.   CommState = ST_POST_WAIT_END;
  367.   
  368.   /* If authentication was required, stuff a header line into
  369.    * the beginning of the message so that people reading it can
  370.    * know who really posted it.  (The From: line may be a lie.)
  371.    */
  372.   if(AuthReqPost) {
  373.     AddAuthHeader(WndPost->hWndEdit);
  374.   }
  375.  
  376.   /* retrieve the edit text, and send it out the socket.
  377.    * post_edit_data handles transformations (dot-doubling and
  378.    * soft line breaks).
  379.    */
  380.  
  381.   CurrentPostEdit = GetEditText (WndPost->hWndEdit);
  382.  
  383.   post_edit_data (CurrentPostEdit);
  384.   
  385.   return (TRUE);
  386. }
  387.  
  388. void
  389. CompletePost(WndEdit * PostEdit, int result)
  390. {
  391.    /* note CommLineIn currently contains the server result "code: text" */
  392.    
  393.    switch (result) {
  394.    case SUCCESS:
  395. #if 0   
  396.      MessageBox(hPostEdit,CommLineIn+4,"Article Posted OK",MB_OK);
  397. #endif   
  398.  
  399.      /* if attaching in non-review mode, then there is no edit window */
  400.      if (!Attaching || (Attaching && ReviewAttach)) {
  401.        if (PostLog) 
  402.          WriteEditLog (PostEdit->hWnd, PostLogFile, CurrentPostEdit, strlen(CurrentPostEdit));
  403.      
  404.        if (CcByMail && CcAddress[0]) {
  405.          strcpy(str, CurrentPostTitle);
  406.          strcat(str, "  [Mailing...]");
  407.          SetWindowText (PostEdit->hWnd, str);
  408.  
  409.          cc_smtp_message(CcAddress, CurrentPostEdit);
  410.        }
  411.  
  412.        PostEdit->dirty = DT_CLEAN;
  413.        DestroyWindow (PostEdit->hWnd);
  414.      }
  415.      break;
  416.  
  417.    case FAIL:
  418.      SetWindowText (PostEdit->hWnd, CurrentPostTitle);
  419.      MessageBox (PostEdit->hWnd, CommLineIn + 4, "Posting Failed", MB_OK | MB_ICONEXCLAMATION);
  420.      /* let 'em fix the post! */
  421.      SendMessage (PostEdit->hWndEdit, EM_SETREADONLY, FALSE, 0L);
  422.      break;
  423.  
  424.    case ABORT:
  425.      break;
  426.    }
  427.    PostEdit = (WndEdit *) NULL;
  428.    GlobalFreePtr (CurrentPostEdit);
  429. }                             
  430. @
  431.  
  432.  
  433. 1.23
  434. log
  435. @New cc-by-mail handler.  New CompletePost() routine for better
  436. abort/cancel handling.  general cleanup for 92.6
  437. @
  438. text
  439. @d3 1
  440. a3 1
  441.  * $Id: wvpost.c 1.22 1994/08/24 18:40:15 mrr Exp $
  442. d60 2
  443. d165 1
  444. @
  445.  
  446.  
  447. 1.22
  448. log
  449. @authorization enables post/mail
  450. @
  451. text
  452. @d3 1
  453. a3 1
  454.  * $Id: wvpost.c 1.21 1994/06/09 18:39:34 rushing Exp $
  455. d14 1
  456. a14 2
  457. #include <windowsx.h>   // for GlobalFreePtr
  458. #include <commdlg.h>
  459. d17 2
  460. d20 4
  461. d61 1
  462. a61 1
  463.       SendMessage (WndPost->hWndEdit, WM_SETFONT, hFontArtNormal, TRUE);
  464. d82 1
  465. a82 1
  466.          return (DWORD)hArticleBackgroundBrush;
  467. d140 3
  468. d215 1
  469. a215 2
  470. PostText (WndPost)
  471.     WndEdit * WndPost;
  472. a217 1
  473.   char *editptr;
  474. d219 5
  475. d239 1
  476. a239 1
  477.   editptr = GetEditText (WndPost->hWndEdit);
  478. d241 4
  479. a244 1
  480.   post_edit_data (editptr);
  481. d246 10
  482. a255 1
  483.   GlobalFreePtr (editptr);
  484. d257 31
  485. a287 2
  486.   return (TRUE);
  487. }
  488. @
  489.  
  490.  
  491. 1.21
  492. log
  493. @word-wrap, dot-doubling, and default port numbers
  494. @
  495. text
  496. @d3 1
  497. a3 1
  498.  * $Id: wvpost.c 1.20 1994/06/06 22:15:31 rushing Exp rushing $
  499. d14 1
  500. a14 1
  501. #include <windowsx.h>    // for GlobalFreePtr
  502. d35 10
  503. a44 10
  504.     {
  505.       if (!WndPosts[ih].hWnd)
  506.         {
  507.           WndPost = &WndPosts[ih] ;
  508.           WndPost->hWnd = hWnd;
  509.           WndPost->Doc = PostDoc ;
  510.  
  511.           break;
  512.         }
  513.     }
  514. d60 1
  515. a60 1
  516.           CreatePostingText (PostDoc, hWnd, WndPost->hWndEdit, DOCTYPE_POSTING);
  517. d69 1
  518. a69 1
  519.       case WM_CTLCOLOR:        //WIN32 doesn't handle this message anymore
  520. d84 1
  521. a84 1
  522.           HIWORD (lParam), TRUE);
  523. d95 3
  524. a97 3
  525.     {
  526.       NextWindow (WndPost->Doc);
  527.     }
  528. d108 1
  529. a108 1
  530.     if ((HWND)(UINT)lParam == WndPost    ->hWndEdit){     
  531. d114 2
  532. a115 2
  533.          WndPost->dirty = DT_DIRTY ;
  534.      return(0L) ;
  535. d120 1
  536. a120 1
  537.     case IDM_CANCEL:
  538. d122 19
  539. a140 19
  540.     case IDV_EXIT:
  541.          DoEditClose(WndPost->hWnd,WndPost->dirty);
  542.       break;
  543.  
  544.     case IDM_SEND:
  545.       StartPost (WndPost);
  546.       break;
  547.  
  548.     case IDM_PRINT:
  549.       PrintFile (WndPost->hWndEdit);
  550.       break;
  551.  
  552.     case IDM_ATTACH:
  553.       if (AskForExistingFileName (hWnd, AttachFileName, "Open file to attach") == FAIL)
  554.           break;
  555.              if (DialogBox (hInst, "WinVnAttach", hWnd, lpfnWinVnAttachDlg))
  556.               Attach (WndPost, AttachFileName, DOCTYPE_POSTING);
  557.       
  558.       InvalidateRect (hWnd, NULL, TRUE);
  559. d143 3
  560. a145 3
  561.     default:
  562.       DoEditCommands (WndPost->hWndEdit, wParam, lParam);
  563.     break;
  564. d159 3
  565. a161 3
  566.      MessageBox (hWnd,
  567.       "Please wait until posting is complete",
  568.       "Cannot close posting window", MB_OK|MB_ICONSTOP);
  569. d163 1
  570. a163 1
  571.     DoEditClose(WndPost->hWnd,WndPost->dirty);
  572. d214 8
  573. @
  574.  
  575.  
  576. 1.20
  577. log
  578. @oops.
  579. @
  580. text
  581. @d3 1
  582. a3 1
  583.  * $Id: wvpost.c 1.19 1994/06/03 20:44:34 rushing Exp rushing $
  584. d212 1
  585. a212 2
  586.   unsigned int postlen;
  587.  
  588. d215 3
  589. a217 2
  590.   /* Retrieve the text of the edit window, and run through it
  591.    * line by line, sending the lines to the server.
  592. d222 1
  593. a222 18
  594. /* The data in a TextEdit window is already in netascii format,
  595.  * so it can just be sent to PutCommData(), which is really
  596.  * gensock_put_data(), which is really winsock.send().
  597.  */
  598.  
  599.   postlen = strlen(editptr);
  600.   PutCommData (editptr, postlen);
  601.  
  602.   /* this handles the case where the user doesn't hit return
  603.    * on the last line...
  604.    */
  605.  
  606.   if (editptr[postlen] != '\n') {
  607.     PutCommData ("\r\n.\r\n", 5);
  608.   }
  609.   else {
  610.     PutCommData (".\r\n", 3);
  611.   }
  612. @
  613.  
  614.  
  615. 1.19
  616. log
  617. @catch missing newline on the end of a post.
  618. @
  619. text
  620. @d3 1
  621. a3 59
  622.  *
  623.  * $Id: wvpost.c 1.18 1994/05/27 01:29:29 rushing Exp rushing $
  624.  * $Log: wvpost.c $
  625.  * Revision 1.18  1994/05/27  01:29:29  rushing
  626.  * unnecessary winundoc.h
  627.  *
  628.  * Revision 1.17  1994/05/26  22:19:08  jglasser
  629.  * warnings
  630.  *
  631.  * Revision 1.16  1994/05/19  02:02:10  rushing
  632.  * changes for gensock & version 0.91
  633.  *
  634.  * Revision 1.15  1994/02/09  18:39:32  rushing
  635.  * ':' missing on case
  636.  *
  637.  * Revision 1.14  1994/02/09  18:01:08  cnolan
  638.  * cnolan 90.2 changes
  639.  *
  640.  * Revision 1.13  1994/01/24  17:40:28  jcoop
  641.  * 90.2 changes
  642.  *
  643.  * Revision 1.12  1994/01/15  20:35:34  jcoop
  644.  * Attachments, font/colors, global editWnd
  645.  *
  646.  * Revision 1.11  1994/01/11  18:51:45  cnolan
  647.  * from cnolan (missing changes)
  648.  * 
  649.  * Revision 1.10  1993/12/08  01:28:01  rushing
  650.  * new version box and cr lf consistency
  651.  *
  652.  * Revision 1.9  1993/08/25  18:53:17  mbretherton
  653.  * MRB merge, mail & post logging
  654.  *
  655.  * Revision 1.8  1993/08/25  17:05:17  mbretherton
  656.  * merge from first newsrc.zip
  657.  *
  658.  * Revision 1.7  1993/07/06  21:09:50  cnolan
  659.  * win32 support
  660.  *
  661.  * Revision 1.6  1993/07/06  17:11:56  rushing
  662.  * plugged doeditcommand in to posting window.
  663.  *
  664.  * Revision 1.5  1993/06/28  17:52:17  rushing
  665.  * fixed compiler warnings
  666.  *
  667.  * Revision 1.4  1993/06/11  00:10:35  rushing
  668.  * second merge from Matt Bretherton sources
  669.  *
  670.  *
  671.  * Revision 1.3  1993/05/25  00:00:45  rushing
  672.  * rot13 merge (MRB)
  673.  *
  674.  * Revision 1.2  1993/05/08  17:11:54  rushing
  675.  * correct handling of NNTP data lines beginning with '.'
  676.  *
  677.  * Revision 1.1  1993/02/16  20:54:22  rushing
  678.  * Initial revision
  679.  *
  680.  *
  681. d234 1
  682. a234 1
  683.   if (editptr[strlen] != '\n') {
  684. d239 1
  685. @
  686.  
  687.  
  688. 1.18
  689. log
  690. @unnecessary winundoc.h
  691. @
  692. text
  693. @d4 1
  694. a4 1
  695.  * $Id: wvpost.c 1.17 1994/05/26 22:19:08 jglasser Exp rushing $
  696. d6 3
  697. d270 1
  698. d273 1
  699. a273 1
  700.   
  701. d279 1
  702. a279 1
  703.   
  704. d285 12
  705. a296 1
  706.   PutCommData (editptr, strlen(editptr));
  707. a297 1
  708.   PutCommLine (".");
  709. @
  710.  
  711.  
  712. 1.17
  713. log
  714. @warnings
  715. @
  716. text
  717. @d4 1
  718. a4 1
  719.  * $Id: wvpost.c 1.16 1994/05/19 02:02:10 rushing Exp jglasser $
  720. d6 3
  721. a72 2
  722. #include "winundoc.h"
  723.  
  724. @
  725.  
  726.  
  727. 1.16
  728. log
  729. @changes for gensock & version 0.91
  730. @
  731. text
  732. @d4 1
  733. a4 1
  734.  * $Id: wvpost.c 1.15 1994/02/09 18:39:32 rushing Exp $
  735. d6 3
  736. d264 1
  737. a264 2
  738.   char outline[MAXOUTLINE];
  739.   char *outptr;
  740. a265 2
  741.   int linelen;
  742.   BOOL EndBuf = FALSE;
  743. d267 1
  744. a267 2
  745.  
  746.    CommState = ST_POST_WAIT_END;
  747. a280 31
  748.  
  749. #if 0
  750.   while (!EndBuf)
  751.     {
  752.       for (linelen = 0, outptr = outline;
  753.        *editptr && *editptr != '\r' && linelen < MAXOUTLINE;
  754.        linelen++)
  755.     { /* special case of a line starting with '.' */
  756.       if ((outptr == outline) && (*editptr == '.'))
  757.         *(outptr++) = '.';
  758.       else
  759.         *(outptr++) = *(editptr++);
  760.     }
  761.  
  762.       if (linelen == 0) {
  763.     linelen = 1;
  764.     outline[0] = '\r';
  765.       }
  766.  
  767.       PutCommLine (outline, linelen);
  768.  
  769.       if (*editptr == '\r')
  770.     editptr++;
  771.       if (*editptr == '\n')
  772.     editptr++;
  773.       if (!*editptr)
  774.     {
  775.       EndBuf = TRUE;
  776.     }
  777.     }
  778. #endif
  779. @
  780.  
  781.  
  782. 1.15
  783. log
  784. @':' missing on case
  785. @
  786. text
  787. @d4 1
  788. a4 1
  789.  * $Id: wvpost.c 1.14 1994/02/09 18:01:08 cnolan Exp rushing $
  790. d6 3
  791. d243 2
  792. a244 2
  793.       strcpy (outline, "POST\r");
  794.       PutCommLine (outline, strlen (outline));
  795. d276 8
  796. d312 1
  797. d314 1
  798. a314 1
  799.   PutCommLine (".\r", 2);
  800. @
  801.  
  802.  
  803. 1.14
  804. log
  805. @cnolan 90.2 changes
  806. @
  807. text
  808. @d4 1
  809. a4 1
  810.  * $Id: wvpost.c 1.13 1994/01/24 17:40:28 jcoop Exp $
  811. d6 3
  812. d117 1
  813. a117 1
  814.       case WM_CTLCOLOR        //WIN32 doesn't handle this message anymore
  815. @
  816.  
  817.  
  818. 1.13
  819. log
  820. @90.2 changes
  821. @
  822. text
  823. @d4 1
  824. a4 1
  825.  * $Id: wvpost.c 1.12 1994/01/15 20:35:34 jcoop Exp $
  826. d6 3
  827. d111 4
  828. a114 1
  829.     case WM_CTLCOLOR:
  830. d117 1
  831. d119 2
  832. a120 2
  833.          SetTextColor(wParam, ArticleTextColor);
  834.          SetBkColor(wParam, ArticleBackgroundColor);
  835. @
  836.  
  837.  
  838. 1.12
  839. log
  840. @Attachments, font/colors, global editWnd
  841. @
  842. text
  843. @d4 1
  844. a4 1
  845.  * $Id: wvpost.c 1.11 1994/01/11 18:51:45 cnolan Exp $
  846. d6 3
  847. d165 1
  848. a165 1
  849.       StartPost (hWnd);
  850. d196 6
  851. a201 1
  852.      DoEditClose(WndPost->hWnd,WndPost->dirty);
  853. a215 2
  854.  *    Entry    ih    is the index into hWndPostEdits of the child
  855.  *                   edit window containing the article.
  856. d218 1
  857. a218 1
  858. StartPost (HWND hWnd)
  859. d223 1
  860. a223 1
  861.   if (!TestCommBusy(hWnd, "Can't post article right now"))
  862. d228 2
  863. a229 2
  864.       CommWnd = hWnd;
  865.  
  866. @
  867.  
  868.  
  869. 1.11
  870. log
  871. @from cnolan (missing changes)
  872. @
  873. text
  874. @d4 1
  875. a4 1
  876.  * $Id: wvpost.c 1.10 1993/12/08 01:28:01 rushing Exp $
  877. d6 3
  878. d50 3
  879. a52 2
  880.  
  881. #include "windows.h"
  882. a66 1
  883.  
  884. d92 2
  885. d95 2
  886. a96 8
  887.       WndPost->hWndEdit = CreateWindow ("edit", (char *) NULL,
  888.          WS_CHILD | WS_VISIBLE | WS_HSCROLL | WS_VSCROLL | WS_BORDER
  889.                           | ES_LEFT | ES_MULTILINE |
  890.                          ES_AUTOHSCROLL | ES_AUTOVSCROLL
  891.                                ,
  892.                                0, 0, 0, 0,
  893.                          hWnd, EDITID, hInst, NULL);
  894.  
  895. d98 2
  896. a99 1
  897.       CreatePostingText (PostDoc, hWnd, WndPost->hWndEdit, DOCTYPE_POSTING);
  898. d105 11
  899. d169 9
  900. d186 2
  901. a189 1
  902.       
  903. d217 1
  904. a217 1
  905.   if (CommBusy)
  906. a218 5
  907.       MessageBox (hWnd, "Sorry, I am already busy retrieving information from the server.\n\
  908. Try again in a little while.", "Can't post article right now", MB_OK | MB_ICONASTERISK);
  909.     }
  910.   else
  911.     {
  912. a244 1
  913.   HANDLE hEditBuffer;
  914. d255 2
  915. a256 3
  916.   hEditBuffer = (HANDLE) SendMessage (WndPost->hWndEdit, EM_GETHANDLE, 0, 0L);
  917.   editptr = LocalLock (hEditBuffer);
  918.  
  919. d286 2
  920. a287 1
  921.   LocalUnlock (hEditBuffer);
  922. a288 1
  923.   PutCommLine (".\r", 2);
  924. @
  925.  
  926.  
  927. 1.10
  928. log
  929. @new version box and cr lf consistency
  930. @
  931. text
  932. @d4 1
  933. a4 1
  934.  * $Id: wvpost.c 1.9 1993/08/25 18:53:17 mbretherton Exp rushing $
  935. d6 3
  936. d131 7
  937. a137 4
  938.  
  939.       if (LOWORD(lParam) == WndPost->hWndEdit)
  940.       {  // Edit Window notifications to parent
  941.      if (HIWORD(lParam) == EN_CHANGE)
  942. @
  943.  
  944.  
  945. 1.9
  946. log
  947. @MRB merge, mail & post logging
  948. @
  949. text
  950. @d1 1
  951. d4 1
  952. a4 1
  953.  * $Id: wvpost.c 1.8 1993/08/25 17:05:17 mbretherton Exp $
  954. d6 3
  955. d202 1
  956. a202 1
  957.       strcpy (outline, "POST");
  958. @
  959.  
  960.  
  961. 1.8
  962. log
  963. @merge from first newsrc.zip
  964. @
  965. text
  966. @d3 1
  967. a3 1
  968.  * $Id: wvpost.c 1.7 1993/07/06 21:09:50 cnolan Exp $
  969. d5 3
  970. d127 1
  971. a127 1
  972.          if (HIWORD(lParam) == EN_CHANGE)
  973. d129 1
  974. a129 1
  975.          return(0L) ;
  976. d134 2
  977. a135 1
  978.            case IDM_CANCEL:
  979. d150 1
  980. a150 1
  981.         break;
  982. d152 1
  983. d213 2
  984. a214 3
  985. PostText (ih, DocType)
  986.      int ih;
  987.      int DocType;
  988. a215 2
  989.  
  990.   HWND hWndPostEdit;
  991. d224 2
  992. a225 6
  993.   if (DocType == DOCTYPE_POSTING)
  994.     {
  995.       hWndPostEdit = WndPosts[ih].hWndEdit;
  996.       CommState = ST_POST_WAIT_END;
  997.     }
  998.  
  999. d230 1
  1000. a230 1
  1001.   hEditBuffer = (HANDLE) SendMessage (hWndPostEdit, EM_GETHANDLE, 0, 0L);
  1002. @
  1003.  
  1004.  
  1005. 1.7
  1006. log
  1007. @win32 support
  1008. @
  1009. text
  1010. @d3 1
  1011. a3 1
  1012.  * $Id: wvpost.c 1.6 1993/07/06 17:11:56 rushing Exp $
  1013. d5 3
  1014. d52 2
  1015. a53 2
  1016.   HWND hWndPostEdit;
  1017.   int found;
  1018. d55 2
  1019. a56 1
  1020.   char mesbuf[348];        /*** debug */
  1021. d58 1
  1022. a58 10
  1023.   for (ih = 0, found = FALSE; !found && ih < MAXPOSTWNDS; ih++)
  1024.     {
  1025.       if (hWndPosts[ih] == hWnd)
  1026.     {
  1027.       hWndPostEdit = hWndPostEdits[ih];
  1028.       found = TRUE;
  1029.       break;
  1030.     }
  1031.     }
  1032.   if (!found && message == WM_CREATE)
  1033. d60 1
  1034. a60 1
  1035.       for (ih = 0; !found && ih < MAXVIEWS; ih++)
  1036. d62 1
  1037. a62 1
  1038.       if (!hWndPosts[ih])
  1039. d64 4
  1040. a67 2
  1041.           found = TRUE;
  1042.           hWndPosts[ih] = hWnd;
  1043. d80 1
  1044. a80 1
  1045.       hWndPostEdit = hWndPostEdits[ih] = CreateWindow ("edit", (char *) NULL,
  1046. d87 3
  1047. a89 3
  1048.       sprintf (mesbuf, "hWndPostEdits[%d] = %5d\r\n       ", ih, hWndPostEdits[ih]);
  1049.       /*   MessageBox(hWnd,mesbuf,"Edit Window Results",MB_OK|MB_ICONASTERISK); */
  1050.       SetWindowText (hWndPostEdits[ih], mesbuf);
  1051. a90 2
  1052.       CreatePostingText (PostDoc, hWnd, hWndPostEdit, DOCTYPE_POSTING);
  1053.       /*   SetFocus(hWndEdits[ih]);  */
  1054. d92 1
  1055. a92 2
  1056.       SetWindowLong(hWndPostEdit, GWL_WNDPROC, (LONG) lpfnEditSubClass);
  1057.  
  1058. d97 1
  1059. a97 1
  1060.       MoveWindow (hWndPostEdit, 0, 0, LOWORD (lParam),
  1061. a98 1
  1062.  
  1063. d102 2
  1064. a103 1
  1065.       SetFocus (hWndPostEdit);
  1066. d107 1
  1067. d110 1
  1068. a110 1
  1069.       NextWindow (&(PostingDocs[ih]));
  1070. d115 2
  1071. a116 33
  1072.  /*                        looks better than WM_MENUSELECT:
  1073.                            but possibly WM_INITMENU is better !   */
  1074.     {  DWORD dwResult ;
  1075.        UINT action;
  1076.        HMENU hMenu = GetMenu(hWnd);
  1077.  
  1078.            dwResult = SendMessage (hWndPostEdit, EM_GETSEL, 0, 0L);
  1079.  
  1080.        if ( HIWORD (dwResult) == LOWORD (dwResult) )
  1081.        {   /* No selection to ROT,Copy or Cut */
  1082.            action=MF_GRAYED ;
  1083.        } else
  1084.            {
  1085.            action=MF_ENABLED ;
  1086.        }
  1087.            EnableMenuItem(hMenu,IDM_ROT13,action) ;
  1088.        EnableMenuItem(hMenu,IDM_COPY,action) ;
  1089.        EnableMenuItem(hMenu,IDM_CUT,action) ;
  1090.        EnableMenuItem(hMenu,IDM_CLEAR,action) ;
  1091.  
  1092.        if (IsClipboardFormatAvailable(CF_TEXT))
  1093.        { 
  1094.            action=MF_ENABLED ;
  1095.            } else
  1096.        {   /* No Clip board contents to paste */
  1097.             action=MF_GRAYED ;
  1098.        }
  1099.            EnableMenuItem(hMenu,IDM_PASTE,action) ;
  1100.  
  1101.        /* and should do an EM_CANUNDO to see if Undo available
  1102.          but don't have the edit window handle  */
  1103.               
  1104.         }
  1105. d119 1
  1106. d121 8
  1107. d130 2
  1108. a131 3
  1109.     {
  1110.  
  1111.     case IDM_CANCEL:
  1112. d133 1
  1113. a133 1
  1114.       DestroyWindow (hWnd);
  1115. d136 2
  1116. a137 2
  1117.     case IDM_POST:
  1118.       StartPost (ih);
  1119. d140 3
  1120. a142 3
  1121.         case IDM_PRINT:
  1122.       PrintFile (hWndPostEdit);
  1123.           break;
  1124. d144 4
  1125. a147 5
  1126.  
  1127.      default:
  1128.       DoEditCommands (hWndPostEdit, wParam, lParam);
  1129.       break;
  1130.     }
  1131. d151 2
  1132. a152 2
  1133.       hWndPosts[ih] = 0;
  1134.       hWndPostEdits[ih] = 0;
  1135. d156 4
  1136. d162 1
  1137. a162 2
  1138.       break;
  1139.       
  1140. d176 1
  1141. a176 2
  1142. StartPost (ih)
  1143.      int ih;
  1144. d183 1
  1145. a183 1
  1146.       MessageBox (hWndPosts[ih], "Sorry, I am already busy retrieving information from the server.\n\
  1147. d191 1
  1148. a191 1
  1149.       CommDoc = &(PostingDocs[ih]);
  1150. d224 1
  1151. a224 1
  1152.       hWndPostEdit = hWndPostEdits[ih];
  1153. d248 2
  1154. a249 2
  1155.         linelen = 1;
  1156.         outline[0] = '\r';
  1157. @
  1158.  
  1159.  
  1160. 1.6
  1161. log
  1162. @plugged doeditcommand in to posting window.
  1163. @
  1164. text
  1165. @d3 1
  1166. a3 1
  1167.  * $Id: wvpost.c 1.5 1993/06/28 17:52:17 rushing Exp rushing $
  1168. d5 3
  1169. d156 1
  1170. a156 1
  1171.       switch (wParam)
  1172. @
  1173.  
  1174.  
  1175. 1.5
  1176. log
  1177. @fixed compiler warnings
  1178. @
  1179. text
  1180. @d3 1
  1181. a3 1
  1182.  * $Id: wvpost.c 1.4 1993/06/11 00:10:35 rushing Exp rushing $
  1183. d5 3
  1184. d169 3
  1185. a171 18
  1186.     case IDM_ROT13:
  1187.       { DWORD dwResult ;
  1188.         WORD  wStart, wEnd ;
  1189.             char *editptr;
  1190.         HANDLE hEditBuffer;
  1191.  
  1192.         dwResult = SendMessage (hWndPostEdit, EM_GETSEL, 0, 0L);
  1193.         wStart = LOWORD (dwResult) ;
  1194.         wEnd   = HIWORD (dwResult) ;
  1195.  
  1196.             hEditBuffer = (HANDLE) SendMessage (hWndPostEdit, EM_GETHANDLE, 0, 0L);
  1197.             editptr = LocalLock (hEditBuffer);
  1198.  
  1199.         strnROT13(editptr + wStart, wEnd - wStart) ;
  1200.  
  1201.         LocalUnlock (hEditBuffer);
  1202.         InvalidateRect (hWndPostEdit, NULL, TRUE);
  1203.       }
  1204. a172 1
  1205.  
  1206. d175 1
  1207. a175 2
  1208.  
  1209.  
  1210. a177 1
  1211.  
  1212. d179 1
  1213. a179 1
  1214.  
  1215. a181 1
  1216.  
  1217. d184 2
  1218. @
  1219.  
  1220.  
  1221. 1.4
  1222. log
  1223. @second merge from Matt Bretherton sources
  1224. @
  1225. text
  1226. @d3 1
  1227. a3 1
  1228.  * $Id: wvpost.c 1.3 1993/05/25 00:00:45 rushing Exp $
  1229. d5 2
  1230. d8 1
  1231. d91 1
  1232. a91 1
  1233.       SetWindowLong(hWndPostEdit, GWL_WNDPROC, (FARPROC) lpfnEditSubClass);
  1234. @
  1235.  
  1236.  
  1237. 1.3
  1238. log
  1239. @rot13 merge (MRB)
  1240. @
  1241. text
  1242. @d3 1
  1243. a3 1
  1244.  * $Id: wvpost.c 1.2 1993/05/08 17:11:54 rushing Exp $
  1245. d5 4
  1246. d87 3
  1247. d149 1
  1248. a158 25
  1249.     case IDM_UNDO:
  1250.       SendMessage (hWndPostEdit, WM_UNDO, 0, 0L);
  1251.       break;
  1252.  
  1253.     case IDM_CUT:
  1254.       SendMessage (hWndPostEdit, WM_CUT, 0, 0L);
  1255.       break;
  1256.  
  1257.     case IDM_COPY:
  1258.       SendMessage (hWndPostEdit, WM_COPY, 0, 0L);
  1259.       break;
  1260.  
  1261.     case IDM_PASTE:
  1262.       SendMessage (hWndPostEdit, WM_PASTE, 0, 0L);
  1263.       break;
  1264.  
  1265.     case IDM_CLEAR:
  1266.       SendMessage (hWndPostEdit, WM_CLEAR, 0, 0L);
  1267.       break;
  1268.  
  1269.     case IDM_SELALL:
  1270.       SendMessage (hWndPostEdit, EM_SETSEL, 0,
  1271.                MAKELONG (0, 32767));
  1272.       break;
  1273.  
  1274. a171 1
  1275.  
  1276. @
  1277.  
  1278.  
  1279. 1.2
  1280. log
  1281. @correct handling of NNTP data lines beginning with '.'
  1282. @
  1283. text
  1284. @d3 1
  1285. a3 1
  1286.  * $Id: wvpost.c 1.1 1993/02/16 20:54:22 rushing Exp rushing $
  1287. d5 3
  1288. d103 36
  1289. d177 1
  1290. a177 1
  1291.           PrintFile (hWndPostEdit);
  1292. d179 21
  1293. @
  1294.  
  1295.  
  1296. 1.1
  1297. log
  1298. @Initial revision
  1299. @
  1300. text
  1301. @d3 4
  1302. a6 2
  1303.  * $Id$
  1304.  * $Log$
  1305. d8 1
  1306. d230 9
  1307. a238 3
  1308.       for (linelen = 0, outptr = outline; *editptr && *editptr != '\r' &&
  1309.        linelen < MAXOUTLINE; linelen++)
  1310.     *(outptr++) = *(editptr++);
  1311. d244 1
  1312. @
  1313.